#include "gd32f10x.h"
#include "systick.h"
#include <stdio.h>
#include "main.h"
#include "led.h"
#include "RTC.h"
#include "systick_delay.h"
#include "gd32f10x_eval.h"

/*!
    \brief      main function
    \param[in]  none
    \param[out] none
    \retval     none
*/

int main(void)
{
    gd_eval_com_init(EVAL_COM0);
    LED_Init();
    my_systick_config();
    RTC_Init();
    printf("this is a RTC test!\r\n");
    while (1)
    {
        LED1_Toggle();
        my_systick_delay_ms(1000);
    }
}

/* retarget the C library printf function to the USART */
int fputc(int ch, FILE *f)
{
    usart_data_transmit(EVAL_COM0, (uint8_t)ch);
    while (RESET == usart_flag_get(EVAL_COM0, USART_FLAG_TBE))
        ;
    return ch;
}
